<h1>Listing reports</h1>

<table>
  <tr>
  <th>Label</th>
  <th>Description</th>
  <th>Estimated date</th>
  <th>Priority</th>
  <th>Tag(s)</th>
  <% if logged? %>
    <th></th><th></th><th></th>
  <% end %>
  </tr>

<% @reports.each do |report|

  #get the report class element
  reportClasses=""
  report.reporttags.each { |reporttag|
    reportClasses=reporttag.css_classes+' '+reportClasses unless reporttag.css_classes.nil?
  } unless report.nil?
  %>

  <tr>
    <td><%=h report.label %></td>
    <td><%=h report.description %></td>
    <td><%=h report.estimated_date %></td>
    <td><%=h report.select_priority %></td>
    <td>
    <% report.reporttags.each { |reporttag| %>
        <a class="<%= reportClasses %>" href="<%= url_for(:controller=>"reporttags", :action=>"show",:id=>reporttag.id) %>">
          <%=h reporttag.name %>
        </a>
    <%}%>
    </td>
  <% if logged? %>
    <td><%= link_to 'Show', report %></td>
    <td><%= link_to 'Edit', edit_report_path(report) %></td>
    <td><%= link_to 'Destroy', report, :confirm => 'Are you sure?', :method => :delete %></td>
  <% end %>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New report', new_report_path if logged? %>
